<?php
declare(strict_types=1);

use App\Common\Guard\AdminGuard;
use App\AdminApi\Module\Admin\Enums\UserEnums;
use Zms\Guard\{Config, Drives\RedisDrives};

/**
 * 返回值为Config实例
 * 如:
 *  ['admin'=>new Config(...),'user'=>new Config(...)]
 */
return [
    'admin' => new Config(
        key: 'admin',//应用名称或KEY
        drive: RedisDrives::class,//凭证储存驱动
        ttl: 3600 * 24 * 30,//凭证有效期
        secret: 'header',//凭据传出方式
        secret_key: 'auth-token',//凭据参数
        guard: function (int $key) {//获取授权模型实例
            return AdminGuard::where(['id' => $key, 'status' => UserEnums::STATUS_USABLE])->whereRaw("`locking`<?", [time()])->first();
        }
    )
];